package com.ytt.myspringboot_project.o1kafka.controller;

import com.ytt.myspringboot_project.o1kafka.O1TemperatureProducer;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/api/temperature")
public class TemperatureController {

    @Resource
    O1TemperatureProducer temperatureProducer;

    @GetMapping("/send")
    public String sendTemperature() {
        temperatureProducer.sendTemperatureData();
        return "温度数据已发送到 Kafka";
    }



}
